// 引入路由
import VueRouter from "vue-router";

// 声明一个路由实例，赋值给router
let router = new VueRouter({
    // 路由列表，写路由的详细规则
    routes: [
        // redirect 重定向
        {path: '/', redirect: '/login'},
        // 把 index.vue 组件映射到 /index 路径，下同
        // {path: '/index', component: () => import('@/page/index')},
        {path: '/login', component: () => import('@/page/login')},
        {path: '/register', component: () => import('@/page/register')},
        {path: '/pwdforget', component: () => import('@/page/pwdforget')},
        {path: '/main', component: () => import('@/page/main')},
    ],
    // 设置mode为history，可以去掉路径上的/#/号
    mode: 'history'
})

// 把router导出供其他模块使用
export default router